Module: Yast::SmtDialogsInclude
- Defined in:
- /home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb
Constant Summary collapse
- REQUIRED_PACKAGES =
[ "smt" ]
Instance Method Summary collapse
-
#AddEditScheduledMirroring(schd_id) ⇒ Object
Opens up dialog for adding or editing a cron-job entry.
- #AdjustAddEditDialogToFrequency ⇒ Object
- #AdjustAdditionalFilters ⇒ Object
- #AdjustRepositoriesButtons ⇒ Object
- #AskForSnapshotSigningKey(snapshot_settings) ⇒ Object
- #CatalogsTableContent ⇒ Object
- #ChangeAllListedPatches(new_state) ⇒ Object
- #CheckAlreadyMirroredRepositories ⇒ Object
-
#CheckConfigDialog ⇒ Object
FATE #305541, Check if SCCcredentials file exists and offer registration or creating the file if it doesn't.
- #CheckRobotsTXT ⇒ Object
- #ClientsTableContent ⇒ Object
- #CreateSnapshot(type) ⇒ Object
- #CredentialsDialogContent ⇒ Object
- #CutPerriodicalSigns(settings) ⇒ Object
- #CutZeros(with_zeros) ⇒ Object
- #DatabaseDialogContent ⇒ Object
- #DisableScheduledMirroringTable ⇒ Object
-
#EmailValid(e_mail) ⇒ Object
void StoreStagingTableDialog (string id, map event) { }.
- #FindJobName(command) ⇒ Object
- #FindJobScript(command) ⇒ Object
- #FormatHTMLPatchDescription(description) ⇒ Object
- #GetPatchCategoryItems ⇒ Object
- #GetPatchStatus(client_info) ⇒ Object
- #GetPatchStatusIcon(patch) ⇒ Object
- #GetSelectedPatchFilter ⇒ Object
- #GetTranslatedPatchCategory(patch_category) ⇒ Object
- #HandleAddEditEmailAddress(e_mail) ⇒ Object
- #HandleClientsTableDialog(id, event) ⇒ Object
- #HandleCredentialsDialog(id, event) ⇒ Object
- #HandleReportEmailTableDialog(id, event) ⇒ Object
- #HandleRepositoriesTableDialog(id, event) ⇒ Object
- #HandleScheduledDownloadsDialog(id, event) ⇒ Object
- #HandleStagingTableDialog(id, event) ⇒ Object
- #InitClientsTableDialog(id) ⇒ Object
- #InitCredentialsDialog(id) ⇒ Object
- #InitDatabaseDialog(id) ⇒ Object
- #initialize_smt_dialogs(include_target) ⇒ Object
- #InitReportEmails ⇒ Object
- #InitReportEmailTableDialog(id) ⇒ Object
- #InitRepositoriesTableDialog(id) ⇒ Object
- #InitScheduledDownloadsDialog(id) ⇒ Object
- #InitStagingTableDialog(id) ⇒ Object
-
#IsPatchFilteredByType(patchid) ⇒ Boolean
Returns whether a patch is filtered by any current 'category' filter.
- #MirrorRepository(repository_id) ⇒ Object
- #ReadDialog ⇒ Object
- #ReadManagementDialog ⇒ Object
- #ReallyExit ⇒ Object
- #RedrawCatalogsTable(catalogs_filters) ⇒ Object
- #RedrawClientsTableDetails ⇒ Object
- #RedrawClientsTableDialog ⇒ Object
-
#RedrawPatchesDetails ⇒ Object
Fills up details widget with the current patch description.
-
#RedrawPatchesTable(category_filter) ⇒ Object
Redraws the whole table of patches from the current repository.
- #RedrawReportEmailsTable ⇒ Object
- #RedrawRepositoriesStagingMenu ⇒ Object
-
#RedrawScheduledMirroringTable ⇒ Object
Redraws the table of currently scheduled NU mirrorings.
- #RegisterOrFillUpCredentials ⇒ Object
- #ReportEmailTableContent ⇒ Object
- #ReportFilteringNotAllowed ⇒ Object
- #ResetPatchCategoryFilter ⇒ Object
- #ScheduledDownloadsDialogContent ⇒ Object
- #SetFocusTable ⇒ Object
- #SetPatchStatus(patchid, new_status) ⇒ Object
- #StagingTableContent ⇒ Object
- #StoreCredentialsDialog(id, event) ⇒ Object
- #StoreDatabaseDialog(id, event) ⇒ Object
- #StoreReportEmails ⇒ Object
- #StoreReportEmailTableDialog(id, event) ⇒ Object
- #StoreScheduledDownloadsDialog(id, event) ⇒ Object
- #TestCredentials ⇒ Object
- #TogglePatchStatus ⇒ Object
- #ToggleRepository(current_id, entry) ⇒ Object
- #UpdateRepoDetails ⇒ Object
-
#ValidateAndSaveScheduledMirroring(schd_id) ⇒ Object
Validates and saves the cron entry.
- #ValidateCredentialsDialog(id, event) ⇒ Object
- #ValidateDatabaseDialog(id, event) ⇒ Object
- #WriteDialog ⇒ Object
- #WriteManagementDialog ⇒ Object
- #WritePatches ⇒ Object
Instance Method Details
#AddEditScheduledMirroring(schd_id) ⇒ Object
Opens up dialog for adding or editing a cron-job entry.
3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3118 def AddEditScheduledMirroring(schd_id) settings = {} editing = false dialog_ret = false if schd_id != nil && Ops.greater_than(schd_id, -1) settings = Ops.get(SMTData.GetCronSettings, schd_id, {}) if settings == nil Builtins.y2error( "Wrong settings on offset %1: %2", schd_id, SMTData.GetCronSettings ) end editing = true end day_of_week = Builtins.maplist(@nrdays_to_names) do |dof_id, dof_name| Item(Id(dof_id), dof_name, Ops.get(settings, "day_of_week") == dof_id) end freqency_sel = :daily # "*/15" - Every 15 minutes, hours if Builtins.regexpmatch(Ops.get_string(settings, "hour", ""), "\\*/") || Builtins.regexpmatch(Ops.get_string(settings, "minute", ""), "\\*/") freqency_sel = :periodically settings = CutPerriodicalSigns(settings) # Monthly elsif Ops.get_string(settings, "day_of_month", "*") != "*" freqency_sel = :monthly # Weekly elsif Ops.get_string(settings, "day_of_week", "*") != "*" freqency_sel = :weekly end Ops.set(settings, "hour", "0") if Ops.get(settings, "hour") == "*" Ops.set(settings, "minute", "0") if Ops.get(settings, "minute") == "*" if Ops.get(settings, "day_of_month") == "*" Ops.set(settings, "day_of_month", "0") end hour = Builtins.tointeger(CutZeros(Ops.get_string(settings, "hour", "0"))) minute = Builtins.tointeger( CutZeros(Ops.get_string(settings, "minute", "0")) ) day_of_month = Builtins.tointeger( CutZeros(Ops.get_string(settings, "day_of_month", "0")) ) scripts = Builtins.maplist(@smt_cron_scripts) do |script_command, script_name| Item(Id(script_command), script_name) end scripts = Builtins.sort(scripts) do |x, y| Ops.less_than(Ops.get_string(x, 1, "A"), Ops.get_string(y, 1, "A")) end UI.OpenDialog( VBox( HSpacing(35), Left( Heading( editing ? _("Editing a SMT Scheduled Job") : _("Adding New SMT Scheduled Job") ) ), VSpacing(1), HBox( Left( ComboBox( Id(:frequency), Opt(:notify), _("&Frequency"), [ Item(Id(:daily), _("Daily"), freqency_sel == :daily), Item(Id(:weekly), _("Weekly"), freqency_sel == :weekly), Item(Id(:monthly), _("Monthly"), freqency_sel == :monthly), Item( Id(:periodically), _("Periodically"), freqency_sel == :periodically ) ] ) ), HSpacing(2), Left(ComboBox(Id(:job_to_run), _("&Job to Run"), scripts)) ), VSpacing(1), Frame( _("Job Start Time"), HBox( HSpacing(2), VBox( ComboBox( Id("day_of_week"), Opt(:hstretch), _("Day of the &Week"), day_of_week ), IntField(Id("hour"), _("&Hour"), 0, 24, hour) ), HSpacing(2), VBox( IntField( Id("day_of_month"), _("&Day of the Month"), 1, 31, day_of_month ), IntField(Id("minute"), _("&Minute"), 0, 59, minute) ), HSpacing(2) ) ), VSpacing(1), HBox( PushButton( Id(:ok), Opt(:default, :key_F10), editing ? Label.OKButton : Label.AddButton ), HSpacing(2), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ) ) ) AdjustAddEditDialogToFrequency() # select the right script if editing already entered cron job if editing script = FindJobScript(Ops.get_string(settings, "command", "")) # BNC #520557: Handling unknown script if script == "" || script == nil Builtins.y2error("Unable to determine script name %1", settings) scripts = Builtins.add( scripts, Item( Id(Ops.get_string(settings, "command", "")), Builtins.sformat( _("Command: %1"), Ops.get_string(settings, "command", "") ) ) ) UI.ChangeWidget(Id(:job_to_run), :Items, scripts) script = Ops.get_string(settings, "command", "") end UI.ChangeWidget(Id(:job_to_run), :Value, script) end ret = nil while true ret = UI.UserInput if ret == :frequency AdjustAddEditDialogToFrequency() elsif ret == :ok || ret == :next if !ValidateAndSaveScheduledMirroring(schd_id) next else dialog_ret = true break end elsif ret == :cancel dialog_ret = false break else Builtins.y2error("Unhandled ret: %1", ret) end end UI.CloseDialog dialog_ret end |
#AdjustAddEditDialogToFrequency ⇒ Object
3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3025 def AdjustAddEditDialogToFrequency current_freq = Convert.to_symbol(UI.QueryWidget(Id(:frequency), :Value)) day_of_week_available = false day_of_month_available = false if current_freq == :weekly day_of_week_available = true elsif current_freq == :monthly day_of_month_available = true end if current_freq == :periodically UI.ChangeWidget(Id("hour"), :Label, _("Every H-th &Hour")) UI.ChangeWidget(Id("minute"), :Label, _("Every M-th &Minute")) else UI.ChangeWidget(Id("hour"), :Label, _("&Hour")) UI.ChangeWidget(Id("minute"), :Label, _("&Minute")) end UI.ChangeWidget(Id("day_of_week"), :Enabled, day_of_week_available) UI.ChangeWidget(Id("day_of_month"), :Enabled, day_of_month_available) nil end |
#AdjustAdditionalFilters ⇒ Object
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2055 def AdjustAdditionalFilters # a mlti-selection-box label msb_label = _("Exclude All Patches of Selected Categories") UI.OpenDialog( VBox( MinWidth( Builtins.size(msb_label), MarginBox( 1, 1, VBox(MultiSelectionBox(Id(:category_filters), msb_label, [])) ) ), ButtonBox( PushButton(Id(:ok), Opt(:okButton), Label.OKButton), PushButton(Id(:cancel), Opt(:cancelButton), Label.CancelButton) ) ) ) items = Builtins.maplist(@patch_categories) do |patch_type, type_translated| query = { "type" => patch_type, "repositoryid" => @selected_catalog, "group" => @selected_staging_group } Item( Id(patch_type), type_translated, SCR.Read(path(".smt.staging.category_filter"), query) == true ) end UI.ChangeWidget(Id(:category_filters), :Items, items) if items != nil ret = UI.UserInput if ret == :ok newly_active_filters = Convert.convert( UI.QueryWidget(Id(:category_filters), :SelectedItems), :from => "any", :to => "list <string>" ) Builtins.foreach(@patch_categories) do |patch_type, type_translated| command = { "type" => patch_type, "repositoryid" => @selected_catalog, "group" => @selected_staging_group, "status" => Builtins.contains( newly_active_filters, patch_type ) } SCR.Write(path(".smt.staging.category_filter"), command) end end UI.CloseDialog nil end |
#AdjustRepositoriesButtons ⇒ Object
1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1366 def AdjustRepositoriesButtons current_item = Convert.to_string( UI.QueryWidget(Id(:catalogs_table), :CurrentItem) ) # nothing listed / nothing selected return if current_item == nil || current_item == "" # [Mirror Now] new_status_mirror = Ops.get_boolean( @catalogs_info, [current_item, "mirroring"], true ) UI.ChangeWidget(Id(:mirror_now), :Enabled, new_status_mirror) new_status_staging = Ops.get_boolean( @catalogs_info, [current_item, "mirroring"], true ) || Ops.get_boolean(@catalogs_info, [current_item, "staging"], true) UI.ChangeWidget(Id(:toggle_staging), :Enabled, new_status_staging) nil end |
#AskForSnapshotSigningKey(snapshot_settings) ⇒ Object
2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2227 def AskForSnapshotSigningKey(snapshot_settings) backup_settings = snapshot_settings.value # uses 'repositoryid' key can_be_filtered = Convert.to_boolean( SCR.Read( path(".smt.repository.staging_allowed"), snapshot_settings.value ) ) # Repository cannot be filtered, thus cannot be modified # thus doesn't need to be re/signed if can_be_filtered != true Builtins.y2milestone( "Repository cannot be filtered, re/signing not required" ) return true end # Read the key ID only if defined key_id = SMTData.GetCredentialsDefined("LOCAL", "signingKeyID") == true ? SMTData.GetCredentials("LOCAL", "signingKeyID") : nil # No re/signing key in use, ignoring if key_id == nil || key_id == "" Builtins.y2milestone("No signing key used") return true end Builtins.y2milestone("Using KeyID: %1", key_id) Ops.set(snapshot_settings.value, "key", key_id) # Read the signingKeyPassphrase only if defined tmp_passphrase = SMTData.GetCredentialsDefined( "LOCAL", "signingKeyPassphrase" ) == true ? SMTData.GetCredentials("LOCAL", "signingKeyPassphrase") : nil # Passphrase defined in config file if tmp_passphrase != nil Builtins.y2milestone("Using KeyPassphrase from config file") Ops.set(snapshot_settings.value, "passphrase", tmp_passphrase) return true # Passphrase already entered elsif @signing_passphrase != nil Builtins.y2milestone("Using cached KeyPassphrase") Ops.set(snapshot_settings.value, "passphrase", @signing_passphrase) return true end # 0xABDEF -> ABDEF key_id_match = key_id if Builtins.regexpmatch(key_id_match, "^0x.*") key_id_match = Builtins.regexpsub(key_id_match, "^0x(.*)", "\\1") end keys = Builtins.filter(GPG.PrivateKeys) do |one_key| Ops.get(one_key, "id") == key_id_match || Ops.get(one_key, "id") == Ops.add("0x", key_id_match) end # Key description key_description = Builtins.sformat("Key ID: %1", key_id) if Ops.greater_than(Builtins.size(keys), 0) # Multiline key description key_description = Builtins.sformat( _("Key ID: %1\nUID: %2\nFingerprint: %3"), key_id, Builtins.mergestring(Ops.get_list(keys, [0, "uid"], []), "\n"), Ops.get_string(keys, [0, "fingerprint"], "") ) end UI.OpenDialog( VBox( # pop-up heading Left(Heading(_("Signing Key Passphrase"))), # pop-up dialog message # %1 is replaced with a (possibly multiline) key descrioption Left( Label( Builtins.sformat( _( "SMT is configured to sign the snapshot with the following key:\n" + "\n" + "%1\n" + "\n" + "Enter the key passphrase and press OK,\n" + "otherwise press Cancel to skip the signing procedure." ), key_description ) ) ), VSpacing(1), HSquash( MinWidth( 25, VBox( Password(Id(:pass1), Opt(:hstretch), _("Key &Passphrase")), Password(Id(:pass2), Opt(:hstretch), _("&Once Again")) ) ) ), ButtonBox( PushButton(Id(:ok), Opt(:okButton, :default), Label.OKButton), PushButton(Id(:cancel), Opt(:cancelButton), Label.CancelButton) ) ) ) UI.SetFocus(Id(:pass1)) ret = nil while true ret = UI.UserInput if ret == :cancel Builtins.y2warning("Signing will be disabled") snapshot_settings.value = deep_copy(backup_settings) break elsif ret == :ok p1 = Convert.to_string(UI.QueryWidget(Id(:pass1), :Value)) p2 = Convert.to_string(UI.QueryWidget(Id(:pass2), :Value)) if p1 != p2 # pop-up error message Report.Error(_("Entered passphrases are not identical.")) UI.SetFocus(Id(:pass1)) next end Builtins.y2milestone("Passphrase has been entered") Ops.set(snapshot_settings.value, "passphrase", p1) break end end UI.CloseDialog true end |
#CatalogsTableContent ⇒ Object
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 490 def CatalogsTableContent VBox( HBox( Left(TextEntry(Id(:repos_filter), Opt(:notify), _("Repository Filter"), "")), VBox( VSpacing(1), PushButton(Id(:filter), Opt(:default), _("Filter")) ), HStretch() ), Table( Id(:catalogs_table), Opt(:hstretch, :vstretch, :notify, :immediate), Header( _("Name"), _("Target"), _("Mirroring"), _("Staging"), _("Mirrored"), _("Description") ), [] ), Left( HBox( PushButton(Id(:toggle_mirroring), _("Toggle &Mirroring")), PushButton(Id(:toggle_staging), _("Toggle &Staging")), HStretch(), PushButton(Id(:mirror_now), _("Mirror &Now")) ) ) ) end |
#ChangeAllListedPatches(new_state) ⇒ Object
2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2208 def ChangeAllListedPatches(new_state) if @filtering_allowed_for_repository != true ReportFilteringNotAllowed() return end Builtins.foreach(@current_patches) do |patchid, patchdetails| # Patch cannot be changed next if IsPatchFilteredByType(patchid) # Patch has already the requierd status if Ops.get_boolean(@current_patches, [patchid, "filtered"], false) != new_state next end SetPatchStatus(patchid, new_state) end nil end |
#CheckAlreadyMirroredRepositories ⇒ Object
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 779 def CheckAlreadyMirroredRepositories if SMTData.CheckAndAdjustMirroredReposAccess != true Report.Error( Builtins.sformat( # Pop-up error message, %1 is replaced with directory name, %2 with username _( "SMT is unable to set %1 directory permission\nto be recursively writable by %2 user." ), SMTData.GetMirroredReposDirectory, SMTData.GetCredentials("DB", "user") ) ) end nil end |
#CheckConfigDialog ⇒ Object
FATE #305541, Check if SCCcredentials file exists and offer registration or creating the file if it doesn't
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 732 def CheckConfigDialog # defualt dialog return dialog_ret = :next if SMTData.GetSMTServiceStatus != true Builtins.y2milestone( "SMT Service is not enabled, not checking the config" ) return dialog_ret end while SMTData.SystemIsRegistered != true Builtins.y2warning( "No SCCcredentials present, offering registration, etc." ) dialog_ret = RegisterOrFillUpCredentials() Builtins.y2milestone("Dialog ret: %1", dialog_ret) if dialog_ret == :abort || dialog_ret == :back || dialog_ret == :next break end end # Check succeeded after some iterations... if dialog_ret == :again dialog_ret = :next # Aborted? Skip the other tests elsif dialog_ret == :abort return dialog_ret end if SMTData.CheckAndAdjustCredentialsFileAccess != true Report.Error( Builtins.sformat( # Pop-up error message, %1 is replaced with file name, %2 with username _( "SMT is unable to set %1 file permissions\nto be readable by %2 user." ), SMTData.GetSCCcredentialsFile, SMTData.GetCredentials("DB", "user") ) ) end dialog_ret end |
#CheckRobotsTXT ⇒ Object
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 805 def CheckRobotsTXT mirror_to = SMTData.GetCredentials("LOCAL", "MirrorTo") if mirror_to == nil || mirror_to == "" Builtins.y2error("Wrong LOCAL->MirrorTo") return nil end mirror_to = Ops.add(mirror_to, "/robots.txt") return true if !FileUtils.Exists(mirror_to) # Checking for cmd = Builtins.sformat( "grep '^Allow:[ \\t]\\+/\\?repo/keys/\\?' '%1'", mirror_to ) cmd_ret = Convert.to_integer(SCR.Execute(path(".target.bash"), cmd)) # 0 -> some lines found # 1 -> nothing found # 2 -> error if cmd_ret == 2 Builtins.y2warning("Cannot check robots.txt") return false elsif cmd_ret == 0 Builtins.y2milestone("File robots.txt seem to allow /repo/keys") return true end Builtins.y2warning("File robots.txt found! (cmd ret: %1)", cmd_ret) Report.Warning( Builtins.sformat( _( "File %1 has been found in your document root.\n" + "\n" + "Please, make sure, that '/repo/keys' is listed as an allowed directory\n" + "or remove the file. Otherwise SMT server might not work properly." ), mirror_to ) ) false end |
#ClientsTableContent ⇒ Object
524 525 526 527 528 529 530 531 532 533 534 535 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 524 def ClientsTableContent VBox( Left(ReplacePoint(Id(:clients_filter), Empty())), Table( Id(:clients_table), Opt(:hstretch, :vstretch, :notify, :immediate), Header(_("Status"), _("Host Name"), _("Last Contact")), [] ), VSquash(MinHeight(5, RichText(Id(:client_details), ""))) ) end |
#CreateSnapshot(type) ⇒ Object
2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2375 def CreateSnapshot(type) snapshot_settings = { "repositoryid" => @selected_catalog, "group" => @selected_staging_group, "type" => type } # Do not log any passwords! Builtins.y2milestone("Creating snapshot: %1", snapshot_settings) # We allow to change the content just for the 'testing' # snapshot, 'production' is just a copy of that if type == "testing" && ( snapshot_settings_ref = arg_ref(snapshot_settings); _AskForSnapshotSigningKey_result = AskForSnapshotSigningKey( snapshot_settings_ref ); snapshot_settings = snapshot_settings_ref.value; _AskForSnapshotSigningKey_result ) != true return false end # a bussy message UI.OpenDialog(Label(_("Creating repository snapshot..."))) Builtins.y2milestone("Writing patches...") # Flush the cache (filters) from memory to database SCR.Write(path(".smt.staging.patches"), nil) Builtins.y2milestone("Writing snapshot...") # Create snapshot ret = SCR.Write(path(".smt.staging.snapshot"), snapshot_settings) Builtins.y2milestone("Creating snapshot finished with result: %1", ret) UI.CloseDialog if ret != true # a pop-up error message Report.Error(_("An error has occurred while creating the snapshot.")) end RedrawRepositoriesStagingMenu() UpdateRepoDetails() ret end |
#CredentialsDialogContent ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 181 def CredentialsDialogContent HBox( HStretch(), HSquash( VBox( VWeight(2, VStretch()), # TRANSLATORS: check box Left( CheckBox( Id("enable_smt_service"), _("&Enable Subscription Management Tool Service (SMT)") ) ), Left("firewall"), VWeight(1, VStretch()), Left( Frame( _("Customer Center Configuration"), VBox( HBox( HSpacing(1), Left(HSquash( MinWidth( 40, # TRANSLATORS: check box CheckBox( Id("custom"), Opt(:notify), _("&Use Custom Server") ) ) )) ), HBox( HSpacing(1), HWeight(1, HSquash( MinWidth( 35, # TRANSLATORS: text entry InputField(Id("NURegUrl"), _("&Registration Server Url")) ) )), HSpacing(2), HWeight(1, HSquash( MinWidth( 35, # TRANSLATORS: text entry InputField(Id("NUUrl"), _("&Download Server Url")) ) )), HSpacing(1) ), HBox( HSpacing(1), Left(Label(_("Organization (Mirroring) Credentials"))) ), HBox( HSpacing(1), HWeight(1, HSquash( MinWidth( 35, # TRANSLATORS: text entry (User name) InputField(Id("NUUser"), _("&User")) ) )), HSpacing(2), HWeight(1, HSquash( MinWidth( 35, # TRANSLATORS: password entry Password(Id("NUPass"), _("&Password")) ) )), HSpacing(1) ), VSpacing(1), # TRANSLATORS: push button PushButton( Id("test_NU_credentials"), Opt(:key_F6), _("&Test...") ) ) ) ), VWeight(1, VStretch()), Left( HSquash( MinWidth( 45, # TRANSLATORS: text entry (e-mail) InputField( Id("nccEmail"), _("&SCC E-mail Used for Registration") ) ) ) ), Left( HSquash( MinWidth( 45, # TRANSLATORS: text entry (URL) InputField(Id("url"), _("&Your SMT Server URL")) ) ) ), VWeight(1, VStretch()), VWeight(2, VStretch()) ) ), HStretch() ) end |
#CutPerriodicalSigns(settings) ⇒ Object
2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2800 def CutPerriodicalSigns(settings) settings = deep_copy(settings) tmp_settings = deep_copy(settings) Builtins.foreach(["hour", "minute", "day_of_month", "day_of_month"]) do |key| if Builtins.regexpmatch(Ops.get_string(settings, key, ""), "\\*/") Ops.set( settings, key, Builtins.regexpsub( Ops.get_string(settings, key, ""), "\\*/(.*)", "\\1" ) ) end end if tmp_settings != settings Builtins.y2milestone( "Periodicall settings changed %1 -> %2", tmp_settings, settings ) end deep_copy(settings) end |
#CutZeros(with_zeros) ⇒ Object
2792 2793 2794 2795 2796 2797 2798 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2792 def CutZeros(with_zeros) if Builtins.regexpmatch(with_zeros, "^0.+") with_zeros = Builtins.regexpsub(with_zeros, "^0(.+)", "\\1") end with_zeros end |
#DatabaseDialogContent ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 296 def DatabaseDialogContent HBox( HStretch(), HSquash( VBox( VStretch(), Left( HSquash( MinWidth( 40, # TRANSLATORS: password entry Password(Id("DB-password-1"), _("Database &Password")) ) ) ), Left( HSquash( MinWidth( 40, # TRANSLATORS: password entry Password(Id("DB-password-2"), _("C&onfirm Password")) ) ) ), VStretch() ) ), HStretch() ) end |
#DisableScheduledMirroringTable ⇒ Object
2988 2989 2990 2991 2992 2993 2994 2995 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2988 def DisableScheduledMirroringTable UI.ChangeWidget(Id("scheduled_NU_mirroring"), :Enabled, false) UI.ChangeWidget(Id(:add), :Enabled, false) UI.ChangeWidget(Id(:edit), :Enabled, false) UI.ChangeWidget(Id(:delete), :Enabled, false) nil end |
#EmailValid(e_mail) ⇒ Object
void StoreStagingTableDialog (string id, map event) { }
2478 2479 2480 2481 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2478 def EmailValid(e_mail) # very simple e-mail validator Builtins.regexpmatch(e_mail, ".+@.+\\..+") end |
#FindJobName(command) ⇒ Object
2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2829 def FindJobName(command) ret = nil Builtins.foreach(@smt_cron_scripts) do |script_command, script_name| if Builtins.regexpmatch(command, script_command) ret = script_name raise Break end end # BNC #520557: Manual or additional cron commands if ret == nil Builtins.y2error("Unknown cron command: %1", command) ret = Builtins.sformat(_("Command: %1"), command) end ret end |
#FindJobScript(command) ⇒ Object
2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2848 def FindJobScript(command) ret = "" Builtins.foreach(@smt_cron_scripts) do |script_command, script_name| if Builtins.regexpmatch(command, script_command) ret = script_command raise Break end end ret end |
#FormatHTMLPatchDescription(description) ⇒ Object
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1503 def FormatHTMLPatchDescription(description) max = 512 while Builtins.regexpmatch(description, "\n\n") && Ops.greater_than(max, 0) max = Ops.subtract(max, 1) description = Builtins.regexpsub( description, "(.*)\n\n(.*)", "\\1<br><br>\\2" ) end description end |
#GetPatchCategoryItems ⇒ Object
384 385 386 387 388 389 390 391 392 393 394 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 384 def GetPatchCategoryItems items = Builtins.maplist(@patch_categories) do |id, localized| Item(Id(id), localized) end items = Builtins.sort(items) do |x, y| Ops.less_than(Ops.get_string(x, 1, ""), Ops.get_string(y, 1, "")) end Builtins.prepend(items, Item(Id("all"), _("All"))) end |
#GetPatchStatus(client_info) ⇒ Object
1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1832 def GetPatchStatus(client_info) client_info = deep_copy(client_info) ret = true Builtins.foreach(@known_patch_statuses) do |patch_status, translation| if Ops.get(client_info, patch_status) == nil || Ops.greater_than(Ops.get_integer(client_info, patch_status, 0), 0) ret = false raise Break end end ret end |
#GetPatchStatusIcon(patch) ⇒ Object
1684 1685 1686 1687 1688 1689 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1684 def GetPatchStatusIcon(patch) patch = deep_copy(patch) Ops.get_boolean(patch, "testing", false) ? Ops.get_boolean(patch, "filtered", false) ? "-" : "a" : Ops.get_boolean(patch, "filtered", false) ? "f" : "+" end |
#GetSelectedPatchFilter ⇒ Object
402 403 404 405 406 407 408 409 410 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 402 def GetSelectedPatchFilter selected_filter = Convert.to_string( UI.QueryWidget(Id(:category_filter), :Value) ) selected_filter = "" if selected_filter == nil || selected_filter == "all" selected_filter end |
#GetTranslatedPatchCategory(patch_category) ⇒ Object
1539 1540 1541 1542 1543 1544 1545 1546 1547 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1539 def GetTranslatedPatchCategory(patch_category) # Used as a fallback # %1 is replaced with a patch category Ops.get( @patch_categories, patch_category, Builtins.sformat(_("Patch category '%1'"), patch_category) ) end |
#HandleAddEditEmailAddress(e_mail) ⇒ Object
2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2483 def HandleAddEditEmailAddress(e_mail) e_mail = "" if e_mail == nil UI.OpenDialog( VBox( HSquash( MinWidth( 40, InputField( Id("e-mail"), e_mail == "" ? _("New &E-Mail") : _("Editing &E-Mail"), e_mail ) ) ), HBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), HSpacing(2), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ) ) ) UI.SetFocus(Id("e-mail")) ret = nil while true ret = UI.UserInput # Cancel pressed break if ret != :ok # OK pressed new_mail = Convert.to_string(UI.QueryWidget(Id("e-mail"), :Value)) if EmailValid(new_mail) @report_e_mails = Builtins.filter(@report_e_mails) do |one_email| one_email != e_mail end @report_e_mails = Builtins.toset( Builtins.add(@report_e_mails, new_mail) ) break else Report.Error( Builtins.sformat(_("E-mail '%1' is not valid."), new_mail) ) UI.SetFocus(Id("e-mail")) end end UI.CloseDialog RedrawReportEmailsTable() if ret == :ok nil end |
#HandleClientsTableDialog(id, event) ⇒ Object
2423 2424 2425 2426 2427 2428 2429 2430 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2423 def HandleClientsTableDialog(id, event) event = deep_copy(event) action = Ops.get(event, "ID") RedrawClientsTableDetails() if action == :clients_table nil end |
#HandleCredentialsDialog(id, event) ⇒ Object
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1278 def HandleCredentialsDialog(id, event) event = deep_copy(event) action = Ops.get(event, "ID") custom = Convert.to_boolean(UI.QueryWidget(Id("custom"), :Value)) if action == "test_NU_credentials" StoreCredentialsDialog(id, event) TestCredentials() elsif action == "custom" if Convert.to_boolean(UI.QueryWidget(Id("custom"), :Value)) UI.ChangeWidget(Id("NURegUrl"), :Enabled, true) UI.ChangeWidget(Id("NUUrl"), :Enabled, true) UI.ChangeWidget(Id("NURegUrl"), :Value, "") UI.ChangeWidget(Id("NUUrl"), :Value, "") else UI.ChangeWidget(Id("NURegUrl"), :Enabled, false) UI.ChangeWidget(Id("NUUrl"), :Enabled, false) UI.ChangeWidget( Id("NURegUrl"), :Value, "https://scc.suse.com/connect" ) UI.ChangeWidget( Id("NUUrl"), :Value, "https://updates.suse.com/" ) end end nil end |
#HandleReportEmailTableDialog(id, event) ⇒ Object
2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2541 def HandleReportEmailTableDialog(id, event) event = deep_copy(event) return nil if id != "reporting" event_id = Ops.get(event, "ID") if event_id == :add HandleAddEditEmailAddress("") elsif event_id == :edit currently_selected = Convert.to_string( UI.QueryWidget(Id(:report_table), :CurrentItem) ) HandleAddEditEmailAddress(currently_selected) elsif event_id == :delete currently_selected = Convert.to_string( UI.QueryWidget(Id(:report_table), :CurrentItem) ) if Confirm.Delete(currently_selected) @report_e_mails = Builtins.filter(@report_e_mails) do |one_email| one_email != currently_selected end RedrawReportEmailsTable() end end nil end |
#HandleRepositoriesTableDialog(id, event) ⇒ Object
2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2756 def HandleRepositoriesTableDialog(id, event) event = deep_copy(event) return nil if id != "repositories" event_id = Ops.get(event, "ID") current_id = Convert.to_string( UI.QueryWidget(Id(:catalogs_table), :CurrentItem) ) if event_id == :toggle_mirroring ToggleRepository(current_id, "mirroring") elsif event_id == :toggle_staging ToggleRepository(current_id, "staging") elsif event_id == :mirror_now MirrorRepository(@catalogs_info[current_id]["catalog_id"]) RedrawCatalogsTable(@filters) elsif event_id == :catalogs_table # Table->double_click if Ops.get_string(event, "EventReason", "") == "Activated" ToggleRepository(current_id, "mirroring") # Table->selected(_other_item) else AdjustRepositoriesButtons() end elsif event_id == :filter || (event_id == :repos_filter && event["EventReason"] == "Activated") filter = UI.QueryWidget(Id(:repos_filter), :Value) @filters = filter.empty? ? [] : [filter] RedrawCatalogsTable(@filters) end # Catalog have been toggled, re-focus the table again UI.SetFocus(Id(:catalogs_table)) unless event_id == :repos_filter nil end |
#HandleScheduledDownloadsDialog(id, event) ⇒ Object
3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3312 def HandleScheduledDownloadsDialog(id, event) event = deep_copy(event) action = Ops.get(event, "ID") changed = false # Add if action == :add changed = AddEditScheduledMirroring(-1) SetFocusTable() # Edit elsif action == :edit current_item = Convert.to_integer( UI.QueryWidget(Id("scheduled_NU_mirroring"), :CurrentItem) ) changed = AddEditScheduledMirroring(current_item) SetFocusTable() # Delete elsif action == :delete current_item = Convert.to_integer( UI.QueryWidget(Id("scheduled_NU_mirroring"), :CurrentItem) ) if !Confirm.DeleteSelected SetFocusTable() return nil end SMTData.RemoveCronJob(current_item) changed = true SetFocusTable() end RedrawScheduledMirroringTable() if changed nil end |
#HandleStagingTableDialog(id, event) ⇒ Object
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2432 def HandleStagingTableDialog(id, event) event = deep_copy(event) action = Ops.get(event, "ID") reason = Ops.get(event, "EventReason") # Selected another patch in table or double-click if action == :patches_table # Double-click on patch in table if reason == "Activated" TogglePatchStatus() # The rest... else RedrawPatchesDetails() end elsif action == :toggle_patch_status TogglePatchStatus() # Selected another catalog elsif action == :catalogs # Reset the category filter when selecting another catalog ResetPatchCategoryFilter() RedrawPatchesTable("") elsif action == :additional_filters AdjustAdditionalFilters() RedrawPatchesTable(GetSelectedPatchFilter()) elsif action == :category_filter RedrawPatchesTable(GetSelectedPatchFilter()) elsif action == :all_listed_enable ChangeAllListedPatches(true) RedrawPatchesTable(GetSelectedPatchFilter()) elsif action == :all_listed_disable ChangeAllListedPatches(false) RedrawPatchesTable(GetSelectedPatchFilter()) elsif action == :create_snapshot_testing CreateSnapshot("testing") RedrawPatchesTable(GetSelectedPatchFilter()) elsif action == :create_snapshot_production CreateSnapshot("production") RedrawPatchesTable(GetSelectedPatchFilter()) end nil end |
#InitClientsTableDialog(id) ⇒ Object
1937 1938 1939 1940 1941 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1937 def InitClientsTableDialog(id) RedrawClientsTableDialog() nil end |
#InitCredentialsDialog(id) ⇒ Object
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1031 def InitCredentialsDialog(id) Builtins.foreach(["NUUser", "NUPass", "NURegUrl", "NUUrl"]) do |one_entry| value = SMTData.GetCredentials("NU", one_entry) value = "" if value == nil UI.ChangeWidget(Id(one_entry), :Value, value) end Builtins.foreach(["nccEmail", "url"]) do |one_entry| value = SMTData.GetCredentials("LOCAL", one_entry) value = "" if value == nil UI.ChangeWidget(Id(one_entry), :Value, value) end # BNC #514304 # Using fallback FQDN if no URL is set in configuration if SMTData.GetCredentials("LOCAL", "url") == "" value = Hostname.CurrentFQ if value != nil if Builtins.regexpmatch(value, ".*[ \t\n]+.*") value = Builtins.regexpsub(value, "(.*)[ \t\n]+.*", "\\1") end if Ops.greater_than(Builtins.size(value), 0) value = Builtins.sformat("http://%1/", value) Builtins.y2milestone("Using '%1'", value) UI.ChangeWidget(Id("url"), :Value, value) end end end regurl = SMTData.GetCredentials("NU", "NURegUrl") api_type = SMTData.GetCredentials("NU", "ApiType") if api_type != "SCC" api_type = "SCC" regurl = "https://scc.suse.com/connect" UI.ChangeWidget(Id("NURegURL"), :Value, regurl) UI.ChangeWidget(Id("NUURL"), :Value, "https://updates.suse.com/") end if regurl == "https://scc.suse.com/connect" UI.ChangeWidget(Id("custom"), :Value, false) UI.ChangeWidget(Id("NURegUrl"), :Enabled, false) UI.ChangeWidget(Id("NUUrl"), :Enabled, false) else UI.ChangeWidget(Id("custom"), :Value, true) UI.ChangeWidget(Id("NURegUrl"), :Enabled, true) UI.ChangeWidget(Id("NUUrl"), :Enabled, true) end UI.ChangeWidget( Id("enable_smt_service"), :Value, SMTData.GetSMTServiceStatus ) nil end |
#InitDatabaseDialog(id) ⇒ Object
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1120 def InitDatabaseDialog(id) value = SMTData.GetCredentials("DB", "pass") value = "" if value == nil # bnc #390085 UI.ChangeWidget( Id("DB-password-1"), :Label, Builtins.sformat( _("Database Password for %1 User"), SMTData.GetCredentials("DB", "user") ) ) UI.ChangeWidget( Id("DB-password-2"), :Label, Builtins.sformat( _("Database Password for %1 User Once Again"), SMTData.GetCredentials("DB", "user") ) ) UI.ChangeWidget(Id("DB-password-1"), :Value, value) UI.ChangeWidget(Id("DB-password-2"), :Value, value) nil end |
#initialize_smt_dialogs(include_target) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 14 def initialize_smt_dialogs(include_target) Yast.import "UI" textdomain "smt" Yast.include include_target, "smt/helps.rb" Yast.include include_target, "smt/complex.rb" Yast.import "Wizard" Yast.import "Popup" Yast.import "SMTData" Yast.import "Label" Yast.import "Confirm" Yast.import "Progress" Yast.import "Message" Yast.import "PackageSystem" Yast.import "SuSEFirewall" Yast.import "FileUtils" Yast.import "GPG" Yast.import "Hostname" Yast.import "Package" @sl = 100 @text_mode = UI.TextMode @smt_cron_scripts = { "/usr/lib/SMT/bin/smt-repeated-register" => _("SCC Registration"), "/usr/lib/SMT/bin/smt-daily" => _( "Synchronization of Updates" ), "/usr/lib/SMT/bin/smt-gen-report" => _( "Generation of Reports" ), "/usr/lib/SMT/bin/smt-run-jobqueue-cleanup" => _("Job Queue Cleanup") } @status_icons_dir = "/usr/share/icons/hicolor/16x16/status" @smt_status_icons = { # clients "critical" => Builtins.sformat( "%1/client-%2.xpm", @status_icons_dir, "critical" ), "unknown" => Builtins.sformat( "%1/client-%2.xpm", @status_icons_dir, "unknown" ), "updates-available" => Builtins.sformat( "%1/client-%2.xpm", @status_icons_dir, "updates-available" ), "up-to-date" => Builtins.sformat( "%1/client-%2.xpm", @status_icons_dir, "up-to-date" ), # repositories "repo-up-to-date" => Builtins.sformat( "%1/repo-%2.xpm", @status_icons_dir, "up-to-date" ), "repo-not-up-to-date" => Builtins.sformat( "%1/repo-%2.xpm", @status_icons_dir, "not-up-to-date" ) } @smt_patch_icons = { # current status "a" => Builtins.sformat( "%1/patch-%2.xpm", @status_icons_dir, "used" ), "f" => Builtins.sformat( "%1/patch-%2.xpm", @status_icons_dir, "not-used" ), # current action (to be removed, to be used) "-" => Builtins.sformat( "%1/patch-%2.xpm", @status_icons_dir, "remove" ), "+" => Builtins.sformat("%1/patch-%2.xpm", @status_icons_dir, "use") } # patch categories translation map @patch_categories = { # Patch category "recommended" => _("Recommended"), # Patch category "optional" => _("Optional"), # Patch category "security" => _("Security") } # BNC #513169 # Selective mirroring in YaST should be logged to a default location @default_mirrroring_log = "/var/log/smt/smt-mirror.log" @report_e_mails = [] @yes = UI.Glyph(:CheckMark) # opposite to check-mark used in UI, usually not translated @no = _("-") @catalogs_info = {} @current_filter_level = -1 # Stores all the details about the currently listed patches # # # **Structure:** # # $["patchid" : $[patch_details], ...] @current_patches = {} # Currently selected catalog. # Variable is filled up when redrawing a table. @selected_catalog = "" # Currently selected staging group. # Variable is filled up when redrawing a table. @selected_staging_group = "default" # Only some repositories support filtering, although # snapshots can be created from every repository @filtering_allowed_for_repository = false @known_patch_statuses = { "PATCHSTATUS_P" => _("Package manager patches: %1"), "PATCHSTATUS_S" => _("Security patches: %1"), "PATCHSTATUS_R" => _("Recommended patches: %1"), "PATCHSTATUS_O" => _("Optional patches: %1") } @clients_status = {} @signing_passphrase = nil @filters = [] @nrdays_to_names = { "0" => _("Sunday"), "1" => _("Monday"), "2" => _("Tuesday"), "3" => _("Wednesday"), "4" => _("Thursday"), "5" => _("Friday"), "6" => _("Saturday") } @smt_support_checked = nil @cron_rpms_checked = false @cron_rpms_installed = nil end |
#InitReportEmails ⇒ Object
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1311 def InitReportEmails reportEmail = SMTData.GetCredentials("REPORT", "reportEmail") if reportEmail == nil Builtins.y2warning("REPORT/reportEmail not defined yet") reportEmail = "" end reportEmail = Builtins.mergestring( Builtins.splitstring(reportEmail, " \t"), "" ) @report_e_mails = Builtins.toset(Builtins.splitstring(reportEmail, ",")) nil end |
#InitReportEmailTableDialog(id) ⇒ Object
1352 1353 1354 1355 1356 1357 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1352 def InitReportEmailTableDialog(id) InitReportEmails() RedrawReportEmailsTable() nil end |
#InitRepositoriesTableDialog(id) ⇒ Object
1497 1498 1499 1500 1501 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1497 def InitRepositoriesTableDialog(id) RedrawCatalogsTable([]) nil end |
#InitScheduledDownloadsDialog(id) ⇒ Object
2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2997 def InitScheduledDownloadsDialog(id) # Lazy check for cron but only once if @cron_rpms_checked != true @cron_rpms_checked = true @cron_rpms_installed = PackageSystem.CheckAndInstallPackagesInteractive( ["cron"] ) Builtins.y2milestone("cron RPM is installed: %1", @cron_rpms_installed) end if @cron_rpms_installed != true DisableScheduledMirroringTable() # TRANSLATORS: informational message (Report::Message) Report.Message( _( "Scheduled jobs have been disabled due to missing packages.\n" + "To install the missing packages and set up the scheduled jobs,\n" + "you need to restart the YaST SMT Configuration module." ) ) return end RedrawScheduledMirroringTable() nil end |
#InitStagingTableDialog(id) ⇒ Object
2048 2049 2050 2051 2052 2053 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2048 def InitStagingTableDialog(id) RedrawRepositoriesStagingMenu() RedrawPatchesTable("") nil end |
#IsPatchFilteredByType(patchid) ⇒ Boolean
Returns whether a patch is filtered by any current 'category' filter.
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1523 def IsPatchFilteredByType(patchid) this_patch = { "type" => Ops.get_string( @current_patches, [patchid, "type"], "" ), "repositoryid" => @selected_catalog, "group" => @selected_staging_group } Convert.to_boolean( SCR.Read(path(".smt.staging.category_filter"), this_patch) ) == true end |
#MirrorRepository(repository_id) ⇒ Object
2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2628 def MirrorRepository(repository_id) if repository_id == nil || repository_id == "" Builtins.y2error("Unable to mirror: %1", repository_id) end Builtins.y2milestone("Mirroring repository: %1", repository_id) cmd = Builtins.sformat( "/usr/sbin/smt-mirror -L '%1' --repository '%2'", String.Quote(@default_mirrroring_log), String.Quote(repository_id) ) Builtins.y2milestone("Starting process: %1", cmd) process_PID = Convert.to_integer( SCR.Execute(path(".process.start_shell"), cmd) ) Builtins.y2milestone("Got PID: %1", process_PID) if process_PID == nil # Error message Report.Error(_("Unable to mirror the selected repository.")) return end UI.OpenDialog( VBox( Left(Heading(_("Mirroring Repository"))), MinWidth(80, LogView(Id(:log), _("&Progress"), 16, 1024)), ReplacePoint(Id(:button), PushButton(Id(:cancel), _("&Stop"))) ) ) UI.ChangeWidget( Id(:log), :LastLine, Builtins.sformat( _("Started mirroring the selected repository with process ID: %1\n"), process_PID ) ) line = "" ret = nil aborted = false while Convert.to_boolean(SCR.Read(path(".process.running"), process_PID)) == true line = Convert.to_string( SCR.Read(path(".process.read_line"), process_PID) ) if line != nil UI.ChangeWidget(Id(:log), :LastLine, Ops.add(line, "\n")) else Builtins.sleep(200) end ret = UI.PollInput if ret == :cancel Builtins.y2milestone("Really abort?") if Popup.AnyQuestion( # a headline _("Aborting the Mirroring"), # a pop-up question _("Are you sure you want to abort the current mirroring process?"), # push button _("Abort Mirroring"), # push button _("Continue Mirroring"), :focus_no ) UI.ChangeWidget(Id(:log), :LastLine, _("Aborting...\n")) Builtins.y2milestone("Aborting...") SCR.Execute(path(".process.kill"), process_PID) aborted = true break end end end exit_code = SCR.Read(path(".process.status"), process_PID) Builtins.y2milestone("Mirror exit status: %1", exit_code) # any lines left in buffer? line = Convert.to_string(SCR.Read(path(".process.read"), process_PID)) if line != nil && Ops.greater_than(Builtins.size(line), 0) UI.ChangeWidget(Id(:log), :LastLine, Ops.add(line, "\n")) end if !aborted # Flush the internal cache after mirroring Builtins.y2milestone( "Staging allowed: %1: %2", repository_id, SCR.Read( path(".smt.repository.staging_allowed"), { "repositoryid" => repository_id, "force_check" => true } ) ) # BNC #519216: Purge cache right after mirroring SCR.Execute( path(".smt.repository.purge_cache"), { "repositoryid" => repository_id, "group" => @selected_staging_group } ) if exit_code == 0 UI.ChangeWidget(Id(:log), :LastLine, _("Finished\n")) else line = Convert.to_string(SCR.Read(path(".process.read_stderr"), process_PID)) if line != nil && Ops.greater_than(Builtins.size(line), 0) UI.ChangeWidget(Id(:log), :LastLine, Ops.add(line, "\n")) end UI.ChangeWidget(Id(:log), :LastLine, _("Mirroring failed\n")) end UI.ReplaceWidget(Id(:button), PushButton(Id(:ok), Label.OKButton)) UI.UserInput end SCR.Execute(path(".process.release"), process_PID) UI.CloseDialog nil end |
#ReadDialog ⇒ Object
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 537 def ReadDialog # Checking for root's permissions return :abort if !Confirm.MustBeRoot Progress.New( # TRANSLATORS: Dialog caption _("Initializing SMT Configuration"), " ", 4, [ # TRANSLATORS: Progress stage _("Read SMT configuration"), # TRANSLATORS: Progress stage _("Read SMT status"), # TRANSLATORS: Progress stage _("Read firewall settings"), # TRANSLATORS: Progress stage _("Read cron settings") ], [ # TRANSLATORS: Bussy message /progress/ _("Reading SMT configuration..."), # TRANSLATORS: Bussy message /progress/ _("Reading SMT status..."), # TRANSLATORS: Bussy message /progress/ _("Reading firewall settings..."), # TRANSLATORS: Bussy message /progress/ _("Reading cron settings..."), Message.Finished ], "" ) Wizard.SetTitleIcon("yast-smt") Wizard.RestoreHelp(Ops.get(@HELPS, "read", "")) Progress.NextStage Builtins.sleep(@sl) Package.InstallAll(REQUIRED_PACKAGES) or return :abort SMTData.ReadCredentials SMTData.ReadFirstRun SMTData.StorePasswordTMP Progress.NextStage Builtins.sleep(@sl) SMTData.ReadSMTServiceStatus Progress.NextStage Builtins.sleep(@sl) orig = Progress.set(false) SuSEFirewall.Read Progress.set(orig) Progress.NextStage Builtins.sleep(@sl) SMTData.ReadCronSettings SMTData.CronRandomize Progress.NextStage Builtins.sleep(@sl) Progress.Finish :next end |
#ReadManagementDialog ⇒ Object
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 970 def ReadManagementDialog Progress.New( # TRANSLATORS: Dialog caption _("Initializing SMT Configuration"), " ", 1, # TRANSLATORS: Progress stage [ # TRANSLATORS: Progress stage _("Read SMT configuration") ], [ # TRANSLATORS: Bussy message /progress/ _("Reading SMT configuration..."), Message.Finished ], "" ) Wizard.SetTitleIcon("yast-smt") Wizard.RestoreHelp(Ops.get(@HELPS, "read", "")) Progress.NextStage Package.InstallAll(REQUIRED_PACKAGES) or return :abort SMTData.ReadCredentials Progress.Finish :next end |
#ReallyExit ⇒ Object
3357 3358 3359 3360 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3357 def ReallyExit # TRANSLATORS: yes-no popup Popup.YesNo(_("Really exit?\nAll changes will be lost.")) end |
#RedrawCatalogsTable(catalogs_filters) ⇒ Object
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1393 def RedrawCatalogsTable(catalogs_filters) catalogs_filters = deep_copy(catalogs_filters) Builtins.y2milestone("Filter used: %1", catalogs_filters) current_item = Convert.to_string( UI.QueryWidget(Id(:catalogs_table), :CurrentItem) ) catalog_filter = nil if ! catalogs_filters.empty? catalog_filter = catalogs_filters[0] end @catalogs_info = {} # busy message uio = UI.OpenDialog( Label(_("Getting list of the currently available repositories...")) ) catalogs_states = Convert.convert( SCR.Read(path(".smt.repositories.all")), :from => "any", :to => "map <string, map <string, any>>" ) if catalogs_states == nil Builtins.y2error("Error getting available repositories") catalogs_states = {} end mirroring = nil staging = nil catalog_id = nil # Constructing the Filter UI # $[0:["openSUSE", "SLE", ...], 1:["11.1", "SDK", ...], ...] current_item_present = false items = Builtins.maplist(catalogs_states) do |catalogid, one_catalog| if catalog_filter != nil if one_catalog["NAME"].downcase.include? catalog_filter.downcase Builtins.y2debug("match") else next nil end end mirroring = Ops.get_string(one_catalog, "DOMIRROR", "") == "Y" staging = Ops.get_string(one_catalog, "STAGING", "") == "Y" catalog_id = Ops.get_string(one_catalog, "CATALOGID", "0") splititem_nr = -1 # used later in Handle* function Ops.set( @catalogs_info, catalogid, { "mirroring" => mirroring, "staging" => staging, "name" => Ops.get_string(one_catalog, "NAME", ""), "catalog_id" => catalog_id, # empty /--/ == no specific target "target" => Builtins.regexpmatch( Ops.get_string(one_catalog, "TARGET", ""), "^-+$" ) ? "" : Ops.get_string(one_catalog, "TARGET", "") } ) if current_item == Ops.get_string(one_catalog, "ID", "") current_item_present = true end Item( Id(Ops.get_string(one_catalog, "ID", "")), Ops.get_locale(one_catalog, "NAME", _("Unknown")), Ops.get_locale(one_catalog, "TARGET", _("Unknown")), mirroring ? @yes : @no, staging ? @yes : @no, Ops.get_string(one_catalog, "LAST_MIRROR", "") != "" ? Ops.get_string(one_catalog, "LAST_MIRROR", "") : @no, Ops.get_string(one_catalog, "DESCRIPTION", "") ) end items = Builtins.filter(items) { |item| item != nil } items = Builtins.sort(items) do |a, b| Ops.less_than(Ops.get_string(a, 1, ""), Ops.get_string(b, 1, "")) end items = [] if items == nil UI.CloseDialog if uio == true UI.ChangeWidget(Id(:catalogs_table), :Items, items) if current_item_present && current_item != nil UI.ChangeWidget(Id(:catalogs_table), :CurrentItem, current_item) end AdjustRepositoriesButtons() nil end |
#RedrawClientsTableDetails ⇒ Object
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1847 def RedrawClientsTableDetails current_item = Convert.to_integer( UI.QueryWidget(Id(:clients_table), :CurrentItem) ) description = "" if current_item != nil client_info = Ops.get(@clients_status, current_item, {}) status = GetPatchStatus(client_info) description = Builtins.sformat( # %1 Client (is|is not) up-to-date # %2 There are some patches pending... _("%1<br>%2"), status == true ? _("Client is up-to-date") : _("<b>Client is not up-to-date</b>"), status != true ? Builtins.sformat( # %1 is replaced with a comma-separated pieces of info, e.g., 'Security patches: 5' _("There are some patches pending:<br>%1"), # Merges list of pieces of info Builtins.mergestring( Builtins.maplist(@known_patch_statuses) do |key, translation| Builtins.sformat( translation, # if the number of patches is defined but nil Ops.get_integer(client_info, key, 0) == nil ? # Number of patches pending _("Status is unknown") : Ops.get_integer(client_info, key, 0) ) end, ", " ) ) : "" ) else description = _( "There are no registered clients or their status is unknown" ) end UI.ChangeWidget(Id(:client_details), :Value, description) nil end |
#RedrawClientsTableDialog ⇒ Object
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1896 def RedrawClientsTableDialog @clients_status = Convert.convert( SCR.Read(path(".smt.clients.status")), :from => "any", :to => "map <integer, map <string, any>>" ) status = nil statusstring = nil items = Builtins.maplist(@clients_status) do |id, values| status = GetPatchStatus(values) statusstring = Ops.get_string(values, "STATUSSTRING", "") Item( Id(id), term( :cell, term(:icon, Ops.get(@smt_status_icons, statusstring, "")), Ops.get_locale(values, "STATUSLABEL", _("Unknown Status")) ), Ops.get_string(values, "HOSTNAME", Ops.get_string(values, "GUID", "")), Ops.get_locale(values, "LASTCONTACT", _("Never")) ) end items = [] if items == nil items = Builtins.sort(items) do |a, b| Ops.less_than( Ops.get_string(a, [1, 1], ""), Ops.get_string(b, [1, 1], "") ) end UI.ChangeWidget(Id(:clients_table), :Items, items) RedrawClientsTableDetails() nil end |
#RedrawPatchesDetails ⇒ Object
Fills up details widget with the current patch description
1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1550 def RedrawPatchesDetails sel_patchid = Convert.to_string( UI.QueryWidget(Id(:patches_table), :CurrentItem) ) # No repositories at all (with staging enabled) if @selected_catalog == nil || @selected_catalog == "" UI.ChangeWidget(Id(:patch_details), :Value, "") # No patch listed, no patch selected elsif sel_patchid == nil || sel_patchid == "" UI.ChangeWidget( Id(:patch_details), :Value, _("There are no patches available in this repository.") ) return end # If a patch is filtered by the 'patch type' filter, we don't offer # to change it... filtered_by_type = IsPatchFilteredByType(sel_patchid) = filtered_by_type == false && @filtering_allowed_for_repository == true UI.ChangeWidget(Id(:toggle_patch_status), :Enabled, ) patch_description = Ops.get_string( @current_patches, [sel_patchid, "description"], "" ) if filtered_by_type patch_description = Builtins.sformat( # %1 is replaced with a warning that patch is filtered-out by a category filter # %2 is replaced with patch description _("%1\n\n%2"), Builtins.sformat( # Connected with the text above, informs user about the current patch state # %1 is replaced with a translated patch type _( "<b>Patch is filtered-out by patch-category filter (%1) and thus cannot be enabled in this dialog.</b>" ), GetTranslatedPatchCategory( Ops.get_string(@current_patches, [sel_patchid, "type"], "") ) ), patch_description ) end UI.ChangeWidget( Id(:patch_details), :Value, FormatHTMLPatchDescription(patch_description) ) nil end |
#RedrawPatchesTable(category_filter) ⇒ Object
Redraws the whole table of patches from the current repository.
categories ["security", "recommended", "optional"] or "" for no filter used)
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1695 def RedrawPatchesTable(category_filter) # default @filtering_allowed_for_repository = false selected_catalog_group = Convert.to_string( UI.QueryWidget(Id(:catalogs), :Value) ) # The currently selected catalog l = Builtins.splitstring(selected_catalog_group, "-") @selected_catalog = Ops.get(l, 0, "") if Ops.greater_than(Builtins.size(l), 2) l = Builtins.remove(l, 0) @selected_staging_group = Builtins.mergestring(l, "") else @selected_staging_group = Ops.get(l, 1, "default") end # Better to evaluate boolen (for each patch) use_category_filter = category_filter != nil && category_filter != "" # The same current item should be selected after redrawing current_item = Convert.to_string( UI.QueryWidget(Id(:patches_table), :CurrentItem) ) ci_is_listed = false items = [] if @selected_catalog == nil || @selected_catalog == "" Builtins.y2milestone("No catalog selected") else @filtering_allowed_for_repository = Convert.to_boolean( SCR.Read( path(".smt.repository.staging_allowed"), { "repositoryid" => @selected_catalog } ) ) Builtins.y2milestone( "Repository %1 filtering allowed: %2", @selected_catalog, @filtering_allowed_for_repository ) @current_patches = {} patches = Convert.convert( SCR.Read( path(".smt.staging.patches"), { "repositoryid" => @selected_catalog, "group" => @selected_staging_group } ), :from => "any", :to => "list <map>" ) if patches == nil Builtins.y2error( "Cannot get patches for catalog: %1", @selected_catalog ) else testing_status = "" production_status = "" items = Builtins.maplist(patches) do |one_patch| # Filtering-out patches not matching the filter if use_category_filter && category_filter != Ops.get_string(one_patch, "type", "") next nil end Ops.set( @current_patches, Ops.get_string(one_patch, "patchid", ""), one_patch ) # To select the same current_item again if !ci_is_listed && Ops.get_string(one_patch, "patchid", "") == current_item ci_is_listed = true end testing_status = GetPatchStatusIcon(one_patch) production_status = Ops.get_boolean(one_patch, "production", false) ? "a" : "f" Item( Id(Ops.get_string(one_patch, "patchid", "")), Ops.get_string(one_patch, "name", ""), Builtins.tostring(Ops.get_integer(one_patch, "version", 0)), GetTranslatedPatchCategory(Ops.get_string(one_patch, "type", "")), @text_mode ? testing_status : term( :cell, term(:icon, Ops.get(@smt_patch_icons, testing_status, "")) ), @text_mode ? production_status : term( :cell, term(:icon, Ops.get(@smt_patch_icons, production_status, "")) ), Ops.get_string(one_patch, "title", "") ) end end end # If filter is used, remove 'nil's items = Builtins.filter(items) { |one_item| one_item != nil } if use_category_filter items = Builtins.sort(items) do |a, b| Ops.less_than(Ops.get_string(a, 1, ""), Ops.get_string(b, 1, "")) end any_catalog = @selected_catalog != nil && @selected_catalog != "" = Ops.greater_than(Builtins.size(items), 0) && @filtering_allowed_for_repository == true UI.ChangeWidget(Id(:patches_table), :Items, items) UI.ChangeWidget(Id(:toggle_patch_status), :Enabled, ) UI.ChangeWidget(Id(:change_status), :Enabled, ) additional_info = == true || any_catalog != true ? Empty() : Label(_("Repository does not allow patch-filtering")) UI.ReplaceWidget(Id(:patches_table_rp), additional_info) if ci_is_listed UI.ChangeWidget(Id(:patches_table), :CurrentItem, current_item) end RedrawPatchesDetails() UpdateRepoDetails() nil end |
#RedrawReportEmailsTable ⇒ Object
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1338 def RedrawReportEmailsTable items = Builtins.maplist(@report_e_mails) do |one_email| Item(Id(one_email), one_email) end UI.ChangeWidget(Id(:report_table), :Items, items) edit_delete_stat = Ops.greater_than(Builtins.size(items), 0) UI.ChangeWidget(Id(:edit), :Enabled, edit_delete_stat) UI.ChangeWidget(Id(:delete), :Enabled, edit_delete_stat) nil end |
#RedrawRepositoriesStagingMenu ⇒ Object
1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1943 def RedrawRepositoriesStagingMenu catalogs = Convert.convert( SCR.Read(path(".smt.staging.repositories")), :from => "any", :to => "map <string, map>" ) staging_groups = Convert.convert( SCR.Read(path(".smt.staging.groups")), :from => "any", :to => "list <string>" ) repository_uptodate = nil # Remember the selected value current_value = nil if UI.WidgetExists(:catalogs) current_value = Convert.to_string(UI.QueryWidget(Id(:catalogs), :Value)) end items = [] Builtins.foreach(catalogs) do |catalogid, one_catalog| Builtins.foreach(staging_groups) do |groupname| Builtins.y2milestone("Checking: %1-%2", catalogid, groupname) repository_uptodate = Convert.to_boolean( SCR.Read( path(".smt.staging.repository.uptodate"), { "repositoryid" => catalogid, "type" => "testing", "group" => groupname } ) ) && Convert.to_boolean( SCR.Read( path(".smt.staging.repository.uptodate"), { "repositoryid" => catalogid, "type" => "production", "group" => groupname } ) ) items = Builtins.add( items, Item( Id(Ops.add(Ops.add(catalogid, "-"), groupname)), term( :icon, repository_uptodate ? Ops.get(@smt_status_icons, "repo-up-to-date", "") : Ops.get(@smt_status_icons, "repo-not-up-to-date", "") ), Ops.get_string(one_catalog, "TARGET", "") != "" ? # Catalog Name (Target) Builtins.sformat( _("%1 (%2)(%3)"), Ops.get_string(one_catalog, "NAME", ""), Ops.get_string(one_catalog, "TARGET", ""), groupname ) : Builtins.sformat( _("%1 (%2)"), Ops.get_string(one_catalog, "NAME", ""), groupname ), Ops.add(Ops.add(catalogid, "-"), groupname) == current_value ) ) end end items = Builtins.sort(items) do |x, y| Ops.less_than( Builtins.toupper(Ops.get_string(x, 2, "")), Builtins.toupper(Ops.get_string(y, 2, "")) ) end items = [] if items == nil items = Builtins.sort(items) do |a, b| Ops.less_than(Ops.get_string(a, 2, ""), Ops.get_string(b, 2, "")) end UI.ReplaceWidget( Id(:catalogs_rp), Left( ComboBox(Id(:catalogs), Opt(:notify), _("Repository &Name"), items) ) ) if Ops.greater_than(Builtins.size(items), 0) UI.ChangeWidget(Id(:create_snapshot), :Enabled, true) UI.ChangeWidget(Id(:category_filter), :Enabled, true) UI.ChangeWidget(Id(:catalogs), :Enabled, true) else UI.ChangeWidget(Id(:create_snapshot), :Enabled, false) UI.ChangeWidget(Id(:category_filter), :Enabled, false) UI.ChangeWidget(Id(:catalogs), :Enabled, false) end nil end |
#RedrawScheduledMirroringTable ⇒ Object
Redraws the table of currently scheduled NU mirrorings.
2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2862 def RedrawScheduledMirroringTable # Offer adding the script only if exists if @smt_support_checked != true @smt_support_checked = true if FileUtils.Exists("/usr/sbin/smt-support") Builtins.y2milestone("SMT support script exists") Ops.set( @smt_cron_scripts, "/usr/sbin/smt-support -U", _("Uploading Support Configs") ) else Builtins.y2milestone("SMT support script does not exist") end end items = [] counter = -1 Builtins.foreach(SMTData.GetCronSettings) do |one_entry| counter = Ops.add(counter, 1) next if one_entry == nil || one_entry == {} Builtins.foreach( ["day_of_month", "day_of_week", "hour", "minute", "month"] ) do |key| Ops.set(one_entry, key, "*") if Ops.get(one_entry, key) == nil end item = Item(Id(counter)) item = Builtins.add( item, FindJobName(Ops.get_string(one_entry, "command", "")) ) # covers */15 - every 15 minutes/hours periodically = false # More often than 'daily' if Builtins.regexpmatch(Ops.get_string(one_entry, "hour", ""), "\\*/") || Builtins.regexpmatch( Ops.get_string(one_entry, "minute", ""), "\\*/" ) periodically = true # Script-call period, used as a table item item = Builtins.add(item, _("Periodically")) item = Builtins.add(item, "--") item = Builtins.add(item, "--") # Monthly elsif Ops.get_string(one_entry, "day_of_month", "*") != "*" # Script-call period, used as a table item item = Builtins.add(item, _("Monthly")) item = Builtins.add(item, "--") item = Builtins.add( item, Ops.get_locale(one_entry, "day_of_month", _("Undefined")) ) # Weekly elsif Ops.get_string(one_entry, "day_of_week", "*") != "*" # Script-call period, used as a table item item = Builtins.add(item, _("Weekly")) item = Builtins.add( item, Ops.get( @nrdays_to_names, Ops.get_string(one_entry, "day_of_week", ""), _("Undefined") ) ) item = Builtins.add(item, "--") # Daily else # Script-call period, used as a table item item = Builtins.add(item, _("Daily")) item = Builtins.add(item, "--") item = Builtins.add(item, "--") end one_entry = CutPerriodicalSigns(one_entry) if periodically && Ops.get_string(one_entry, "hour", "*") != "*" && Ops.get_string(one_entry, "hour", "0") != "0" item = Builtins.add( item, Builtins.sformat( _("Every %1 hours"), Ops.get_locale(one_entry, "hour", _("Undefined")) ) ) elsif periodically item = Builtins.add(item, "--") else item = Builtins.add( item, Ops.get_locale(one_entry, "hour", _("Undefined")) ) end if periodically && Ops.get_string(one_entry, "minute", "*") != "*" && Ops.get_string(one_entry, "minute", "0") != "0" item = Builtins.add( item, Builtins.sformat( _("Every %1 minutes"), Ops.get_locale(one_entry, "minute", _("Undefined")) ) ) elsif periodically item = Builtins.add(item, "--") else item = Builtins.add( item, Ops.get_locale(one_entry, "minute", _("Undefined")) ) end items = Builtins.add(items, item) end if items == nil items = [] Builtins.y2error("Erroneous items!") end UI.ChangeWidget(Id("scheduled_NU_mirroring"), :Items, items) = items != nil && Builtins.size(items) != 0 UI.ChangeWidget(Id(:edit), :Enabled, ) UI.ChangeWidget(Id(:delete), :Enabled, ) nil end |
#RegisterOrFillUpCredentials ⇒ Object
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 607 def RegisterOrFillUpCredentials Wizard.SetContents( # Dialog caption _("SCC Credentials"), HSquash( VBox( # Informative text Label( _( "System does not appear to be registered in SCC.\nChoose one of the options below." ) ), VSpacing(1), RadioButtonGroup( Id("NCCCredentialsRBB"), Opt(:notify), HBox( HSpacing(2), VBox( # Radio button Left( RadioButton( Id("skip"), Opt(:notify), _("&Skip Registration") ) ), VSpacing(1), # Radio button Left( RadioButton( Id("registration"), Opt(:notify), _("Register in &SUSE Customer Center") ) ), VSpacing(1) ) ) ) ) ), # Help "SCC Credentials", #1 _( "<p><b><big>SCC Credentials</big></b><br>\n" + "You need to register your SMT in SUSE Customer Center to get it working\n" + "properly. Choose one of the listed options.</p>" ) + # Help "SCC Credentials", #2 _( "<p>Choosing <b>Register in SUSE Customer Center</b> would\n" + "call regular SUSE Customer Center Configuration module,\n" + "<b>Generate New SCC Credentials</b> just creates new SCC Credentials\n" + "file without calling SUSE Customer Center Configuration module.</p>" ), true, true ) Wizard.SetTitleIcon("registration") dialog_ret = nil ret = :next # Initial dialog settings decision = "registration" UI.ChangeWidget(Id("NCCCredentialsRBB"), :CurrentButton, decision) while true dialog_ret = UI.UserInput if dialog_ret == :next decision = Convert.to_string( UI.QueryWidget(Id("NCCCredentialsRBB"), :CurrentButton) ) Builtins.y2milestone("User decision: %1", decision) if decision == "skip" if Popup.AnyQuestion( # Pop-up dialog caption _("Warning"), # Pop-up question _( "Leaving the SCC credentials empty might cause SMT not to work properly.\nAre you sure you want to really skip it?" ), # Button label _("&Yes, Skip It"), # Button label _("&Cancel"), :focus_no ) Builtins.y2warning( "User decided to skip registration or entering SCC credentials" ) ret = :next else next end elsif decision == "registration" PackageSystem.EnsureTargetInit wfmret = WFM.CallFunction("inst_scc") Builtins.y2milestone("inst_scc returned: %1", wfmret) ret = :again end break elsif dialog_ret == :back ret = :back break elsif dialog_ret == "skip" || dialog_ret == "registration" decision = Convert.to_string( UI.QueryWidget(Id("NCCCredentialsRBB"), :CurrentButton) ) elsif dialog_ret == :abort || dialog_ret == :cancel if Popup.ReallyAbort(true) ret = :abort break end else Builtins.y2error("Unknown user input: %1", dialog_ret) end end ret end |
#ReportEmailTableContent ⇒ Object
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 358 def ReportEmailTableContent HBox( HStretch(), HSquash( MinWidth( 40, VBox( Table( Id(:report_table), Header(_("E-mail addresses to send reports to")), [] ), Left( HBox( PushButton(Id(:add), _("&Add...")), PushButton(Id(:edit), Label.EditButton), PushButton(Id(:delete), Label.DeleteButton) ) ) ) ) ), HStretch() ) end |
#ReportFilteringNotAllowed ⇒ Object
2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2130 def ReportFilteringNotAllowed # a pop-up message Report.Message( _( "This repository does not allow patch filtering.\nYou can create snapshots of its current stage though." ) ) nil end |
#ResetPatchCategoryFilter ⇒ Object
396 397 398 399 400 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 396 def ResetPatchCategoryFilter UI.ChangeWidget(Id(:category_filter), :Value, "all") nil end |
#ScheduledDownloadsDialogContent ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 327 def ScheduledDownloadsDialogContent VBox( Left(Label(_("List of Scheduled Jobs"))), Table( Id("scheduled_NU_mirroring"), Opt(:vstretch), Header( _("Job to Run"), # TRANSLATORS: table header item _("Frequency"), # TRANSLATORS: table header item _("Day of the Week"), # TRANSLATORS: table header item _("Day of the Month"), # TRANSLATORS: table header item _("Hour"), # TRANSLATORS: table header item _("Minute") ), [] ), Left( HBox( PushButton(Id(:add), Opt(:key_F3), _("&Add...")), PushButton(Id(:edit), Opt(:key_F4), _("&Edit...")), PushButton(Id(:delete), Opt(:key_F5), Label.DeleteButton) ) ) ) end |
#SetFocusTable ⇒ Object
3306 3307 3308 3309 3310 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3306 def SetFocusTable UI.SetFocus(Id("scheduled_NU_mirroring")) nil end |
#SetPatchStatus(patchid, new_status) ⇒ Object
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2118 def SetPatchStatus(patchid, new_status) SCR.Write( path(".smt.staging.patch.status"), { "repositoryid" => @selected_catalog, "group" => @selected_staging_group, "patchid" => patchid, "status" => new_status } ) end |
#StagingTableContent ⇒ Object
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 412 def StagingTableContent VBox( HBox( HSquash( HBox( ReplacePoint( Id(:catalogs_rp), ComboBox(Id(:catalogs), _("Repository &Name"), []) ), ComboBox( Id(:category_filter), Opt(:notify), _("&Patch Category"), GetPatchCategoryItems() ) ) ), HStretch(), VBox(ReplacePoint(Id(:repo_details), Empty())) ), Table( Id(:patches_table), Opt(:hstretch, :vstretch, :notify, :immediate), Header( _("Patch Name"), _("Version"), _("Category"), _("Testing"), _("Production"), _("Summary") ), [] ), HBox( Label(_("Patch Details")), HStretch(), ReplacePoint(Id(:patches_table_rp), Empty()) ), VSquash(MinHeight(4, RichText(Id(:patch_details), ""))), Left( HBox( PushButton(Id(:toggle_patch_status), _("&Toggle Patch Status")), HStretch(), MenuButton( Id(:change_status), _("Change &Status"), [ Item(Id(:additional_filters), _("&Exclude from Snapshot...")), term( :menu, Id(:all_listed), _("&All listed..."), [ Item(Id(:all_listed_enable), _("&Enable")), Item(Id(:all_listed_disable), _("&Disable")) ] ) ] ), MenuButton( Id(:create_snapshot), _("Create Snapshot..."), [ Item( Id(:create_snapshot_testing), _("From Full Mirror to &Testing") ), Item( Id(:create_snapshot_production), _("From Testing to &Production") ) ] ) ) ) ) end |
#StoreCredentialsDialog(id, event) ⇒ Object
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1089 def StoreCredentialsDialog(id, event) event = deep_copy(event) Builtins.foreach(["NUUser", "NUPass", "NURegUrl", "NUUrl"]) do |one_entry| SMTData.SetCredentials( "NU", one_entry, Convert.to_string(UI.QueryWidget(Id(one_entry), :Value)) ) end Builtins.foreach(["nccEmail", "url"]) do |one_entry| SMTData.SetCredentials( "LOCAL", one_entry, Convert.to_string(UI.QueryWidget(Id(one_entry), :Value)) ) end SMTData.SetCredentials("NU", "ApiType", "SCC") new_service_status = Convert.to_boolean( UI.QueryWidget(Id("enable_smt_service"), :Value) ) Builtins.y2milestone( "New SMT status: %1", new_service_status == true ? "enabled" : "disabled" ) SMTData.SetSMTServiceStatus(new_service_status) nil end |
#StoreDatabaseDialog(id, event) ⇒ Object
1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1148 def StoreDatabaseDialog(id, event) event = deep_copy(event) SMTData.SetCredentials( "DB", "pass", Convert.to_string(UI.QueryWidget(Id("DB-password-1"), :Value)) ) nil end |
#StoreReportEmails ⇒ Object
1328 1329 1330 1331 1332 1333 1334 1335 1336 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1328 def StoreReportEmails SMTData.SetCredentials( "REPORT", "reportEmail", Builtins.mergestring(@report_e_mails, ",") ) nil end |
#StoreReportEmailTableDialog(id, event) ⇒ Object
1359 1360 1361 1362 1363 1364 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1359 def StoreReportEmailTableDialog(id, event) event = deep_copy(event) StoreReportEmails() nil end |
#StoreScheduledDownloadsDialog(id, event) ⇒ Object
3352 3353 3354 3355 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3352 def StoreScheduledDownloadsDialog(id, event) event = deep_copy(event) nil end |
#TestCredentials ⇒ Object
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1239 def TestCredentials UI.OpenDialog( MinSize( 52, 12, VBox( # TRANSLATORS: LogView label LogView(Id("test_log"), _("&Test Details"), 5, 100), VSpacing(1), PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton) ) ) ) # complex.ycp ret = CredentialsTest("test_log") if ret == true # TRANSLATORS: LogView line UI.ChangeWidget( Id("test_log"), :LastLine, "\n" + _("Test result: success") + "\n" ) else # TRANSLATORS: LogView line UI.ChangeWidget( Id("test_log"), :LastLine, "\n" + _("Test result: failure") + "\n" ) end UI.UserInput UI.CloseDialog ret end |
#TogglePatchStatus ⇒ Object
2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2141 def TogglePatchStatus if @filtering_allowed_for_repository != true ReportFilteringNotAllowed() return end sel_patchid = Convert.to_string( UI.QueryWidget(Id(:patches_table), :CurrentItem) ) if IsPatchFilteredByType(sel_patchid) # a pop-up message Report.Message( _( "This patch is filtered-out by a category-based filter\nand thus its status cannot be changed in this dialog." ) ) return end status = Ops.get_boolean( @current_patches, [sel_patchid, "filtered"], false ) # Fallback status = false if status == nil # Inverting the status: "filtered" used as new "status" if SetPatchStatus(sel_patchid, status) != true Report.Error(_("Unable to change the current patch status.")) end current_status = Convert.to_boolean( SCR.Read( path(".smt.staging.patch.status"), { "repositoryid" => @selected_catalog, "group" => @selected_staging_group, "patchid" => sel_patchid } ) ) # update the cache Ops.set( @current_patches, [sel_patchid, "filtered"], current_status == false ) status_icon = GetPatchStatusIcon( Ops.get(@current_patches, sel_patchid, {}) ) UI.ChangeWidget( Id(:patches_table), term(:Item, sel_patchid, 3), @text_mode ? status_icon : term(:icon, Ops.get(@smt_patch_icons, status_icon, "")) ) # focus the table again UI.SetFocus(Id(:patches_table)) nil end |
#ToggleRepository(current_id, entry) ⇒ Object
2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 2569 def ToggleRepository(current_id, entry) if current_id == nil Builtins.y2error("Erroneous ID: %1", current_id) # pop-up error message Report.Error(_("Internal Error: Cannot toggle the current state.")) return nil end current_state = Ops.get_boolean(@catalogs_info, [current_id, entry]) if current_state == nil Builtins.y2error( "Erroneous entry: %1 (%2)", Ops.get(@catalogs_info, current_id, {}), entry ) # pop-up error message Report.Error(_("Internal Error: Cannot toggle the current state.")) return nil end cmd_params = { "repositoryid" => current_id } col_to_change = 0 new_state = current_state == false if entry == "mirroring" Ops.set(cmd_params, "mirroring", new_state) col_to_change = 2 elsif entry == "staging" Ops.set(cmd_params, "staging", new_state) col_to_change = 3 else Builtins.y2error("Unknown entry to change: %1", entry) # pop-up error message Report.Error(_("Internal Error: Cannot toggle the current state.")) return nil end success = SCR.Write(path(".smt.repository.set"), cmd_params) Builtins.y2milestone("Adjusting repository %1: %2", cmd_params, success) if success != true Report.Error(_("Internal Error: Cannot toggle the current state.")) else # Switch the current state current_state = current_state == false Ops.set(@catalogs_info, [current_id, entry], current_state) UI.ChangeWidget( Id(:catalogs_table), term(:Item, current_id, col_to_change), current_state == true ? @yes : @no ) end AdjustRepositoriesButtons() nil end |
#UpdateRepoDetails ⇒ Object
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1610 def UpdateRepoDetails additional_info = [] if @selected_catalog == nil || @selected_catalog == "" additional_info = Builtins.add( additional_info, _("There are no repositories with staging enabled") ) else details = Convert.to_map( SCR.Read( path(".smt.staging.repository.details"), { "repositoryid" => @selected_catalog, "group" => @selected_staging_group } ) ) additional_info = Builtins.add( additional_info, Builtins.sformat( _("Mirror timestamp: %1"), Ops.get_string(details, "full", "") != nil && Ops.greater_than( Builtins.size(Ops.get_string(details, "full", "")), 0 ) ? Ops.get_string(details, "full", "") : _("Never mirrored") ) ) additional_info = Builtins.add( additional_info, Builtins.sformat( _("Testing snapshot timestamp: %1"), Ops.get_string(details, "testing", "") != nil && Ops.greater_than( Builtins.size(Ops.get_string(details, "testing", "")), 0 ) ? Ops.get_string(details, "testing", "") : _("Never created") ) ) additional_info = Builtins.add( additional_info, Builtins.sformat( _("Production snapshot timestamp: %1"), Ops.get_string(details, "production", "") != nil && Ops.greater_than( Builtins.size(Ops.get_string(details, "production", "")), 0 ) ? Ops.get_string(details, "production", "") : _("Never created") ) ) end if Ops.greater_than(Builtins.size(additional_info), 0) UI.ReplaceWidget( Id(:repo_details), Label(Opt(:boldFont), Builtins.mergestring(additional_info, "\n")) ) else UI.ReplaceWidget(Id(:repo_details), Empty()) end nil end |
#ValidateAndSaveScheduledMirroring(schd_id) ⇒ Object
Validates and saves the cron entry.
3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 3052 def ValidateAndSaveScheduledMirroring(schd_id) settings = { "day_of_month" => "*", "day_of_week" => "*", "hour" => "*", "minute" => "*", "month" => "*", "command" => "" } current_freq = Convert.to_symbol(UI.QueryWidget(Id(:frequency), :Value)) hour = Builtins.tostring(UI.QueryWidget(Id("hour"), :Value)) minute = Builtins.tostring(UI.QueryWidget(Id("minute"), :Value)) day_of_month = Builtins.tostring( UI.QueryWidget(Id("day_of_month"), :Value) ) day_of_week = Builtins.tostring(UI.QueryWidget(Id("day_of_week"), :Value)) Ops.set(settings, "hour", CutZeros(hour)) Ops.set(settings, "minute", CutZeros(minute)) # Periodical frequency needs to add "*/X" periodical sign if current_freq == :periodically if Ops.get_string(settings, "hour", "0") != "0" && Ops.get_string(settings, "hour", "*") != "*" Ops.set( settings, "hour", Builtins.sformat("*/%1", Ops.get_string(settings, "hour", "0")) ) else Ops.set(settings, "hour", "*") end if Ops.get_string(settings, "minute", "0") != "0" && Ops.get_string(settings, "minute", "*") != "*" Ops.set( settings, "minute", Builtins.sformat("*/%1", Ops.get_string(settings, "minute", "0")) ) else Ops.set(settings, "minute", "*") end elsif current_freq == :weekly Ops.set(settings, "day_of_week", day_of_week) elsif current_freq == :monthly Ops.set(settings, "day_of_month", day_of_month) end command = Convert.to_string(UI.QueryWidget(Id(:job_to_run), :Value)) Ops.set(settings, "command", command) if schd_id != nil && Ops.greater_than(schd_id, -1) SMTData.ReplaceCronJob(schd_id, settings) else SMTData.AddNewCronJob(settings) end true end |
#ValidateCredentialsDialog(id, event) ⇒ Object
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1190 def ValidateCredentialsDialog(id, event) event = deep_copy(event) orig_url = SMTData.GetCredentials("NU", "NURegUrl") url = Convert.to_string(UI.QueryWidget(Id("url"), :Value)) if url == nil || url == "" UI.SetFocus(Id("url")) # Pop-up error message Report.Error( _( "The SMT URL must not be empty.\n" + "\n" + "Enter your SMT server URL in the following format: http:://server.name/\n" ) ) return false # BNC #518222: Check for 'http://.+' or 'https://.+' in URL elsif !Builtins.regexpmatch(url, "^[ \t]*http://.+") && !Builtins.regexpmatch(url, "^[ \t]*https://.+") UI.SetFocus(Id("url")) Report.Error( _( "Invalid SMT Server URL.\n" + "\n" + "URL should start with 'http://' or 'https://'." ) ) return false end nuuser = Convert.to_string(UI.QueryWidget(Id("NUUser"), :Value)) if nuuser == nil || nuuser == "" UI.SetFocus(Id("NUUser")) # Pop-up error message Report.Error(_("Update server user must not be empty.")) return false end nupass = Convert.to_string(UI.QueryWidget(Id("NUPass"), :Value)) if nupass == nil || nupass == "" UI.SetFocus(Id("NUPass")) # Pop-up error message Report.Error(_("Update server password must not be empty.")) return false end true end |
#ValidateDatabaseDialog(id, event) ⇒ Object
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1159 def ValidateDatabaseDialog(id, event) event = deep_copy(event) pass_1 = Convert.to_string(UI.QueryWidget(Id("DB-password-1"), :Value)) pass_2 = Convert.to_string(UI.QueryWidget(Id("DB-password-2"), :Value)) if pass_1 != pass_2 UI.SetFocus(Id("DB-password-1")) # TRANSLATORS: error report Report.Error(_("The first and the second password do not match.")) return false end # pass_1 and pass_2 are equal if pass_1 == nil || pass_1 == "" UI.SetFocus(Id("DB-password-1")) # TRANSLATORS: error report, actually containing a question if !Popup.ContinueCancel( _( "Password should not be empty.\n" + "\n" + "Would you like to continue nevertheless?" ) ) return false end end Builtins.y2milestone("Password validation passed") true end |
#WriteDialog ⇒ Object
851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 851 def WriteDialog stages = [ # TRANSLATORS: Progress stage _("Adjust SMT configuration"), # TRANSLATORS: Progress stage _("Adjust database configuration"), # TRANSLATORS: Progress stage _("Check and install server certificate"), # TRANSLATORS: Progress stage _("Adjust Web-server configuration"), # TRANSLATORS: Progress stage _("Adjust SMT service"), # TRANSLATORS: Progress stage _("Write firewall settings"), # TRANSLATORS: Progress stage _("Write cron settings"), # TRANSLATORS: Progress stage _("Check mirrored repositories"), # TRANSLATORS: Progress stage _("Run synchronization check") ] steps = [ # TRANSLATORS: Bussy message /progress/ _("Adjusting SMT configuration..."), # TRANSLATORS: Bussy message /progress/ _("Adjusting database configuration..."), # TRANSLATORS: Bussy message /progress/ _("Checking and installing server certificate..."), # TRANSLATORS: Bussy message /progress/ _("Adjusting Web server configuration..."), # TRANSLATORS: Bussy message /progress/ _("Adjusting SMT service..."), # TRANSLATORS: Bussy message /progress/ _("Writing firewall settings..."), # TRANSLATORS: Bussy message /progress/ _("Writing cron settings..."), # TRANSLATORS: Bussy message /progress/ _("Checking mirrored repositories..."), # TRANSLATORS: Bussy message /progress/ _("Running synchronization check..."), Message.Finished ] Progress.New( # TRANSLATORS: Dialog caption _("Writing SMT Configuration"), " ", Builtins.size(stages), stages, steps, "" ) Wizard.SetTitleIcon("yast-smt") Wizard.RestoreHelp(Ops.get(@HELPS, "write", "")) SMTData.WriteCredentials Progress.NextStage Builtins.sleep(@sl) Progress.NextStage Builtins.sleep(@sl) # uses credentials SMTData.StartDatabaseIfNeeded SMTData.WriteDatabaseSettings SMTData.ChangePasswordIfDifferent Progress.NextStage Builtins.sleep(@sl) SMTData.WriteCASettings Progress.NextStage Builtins.sleep(@sl) SMTData.CheckAndAdjustApacheConfiguration CheckRobotsTXT() Progress.NextStage Builtins.sleep(@sl) SMTData.WriteSMTServiceStatus Progress.NextStage Builtins.sleep(@sl) orig = Progress.set(false) SuSEFirewall.Write Progress.set(orig) Progress.NextStage Builtins.sleep(@sl) SMTData.WriteCronSettings Progress.NextStage Builtins.sleep(@sl) SMTData.WriteFirstRunStatus Builtins.sleep(@sl) Progress.NextStage # BNC #521013: Checking uses smt agent that connects to database # Database has to be already running CheckAlreadyMirroredRepositories() Progress.NextStage SMTData.RunSmallSync if SMTData.GetSMTServiceStatus == true Progress.Finish :next end |
#WriteManagementDialog ⇒ Object
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 1002 def WriteManagementDialog Progress.New( # TRANSLATORS: Dialog caption _("Writing Changes"), " ", 1, [ # TRANSLATORS: Progress stage _("Write patches") ], [ # TRANSLATORS: Bussy message /progress/ _("Writing patches..."), Message.Finished ], "" ) Wizard.SetTitleIcon("yast-smt") Wizard.RestoreHelp(Ops.get(@HELPS, "write", "")) Progress.NextStage WritePatches() Progress.Finish :next end |
#WritePatches ⇒ Object
796 797 798 799 800 801 802 803 |
# File '/home/abuild/rpmbuild/BUILD/yast2-smt-3.0.13/src/include/smt/dialogs.rb', line 796 def WritePatches # Writing the patches filters, storing to database Builtins.y2milestone("Writing patches...") success = SCR.Write(path(".smt.staging.patches"), nil) Builtins.y2milestone("Writing patches returned: %1", success) nil end |