コード例 #1
0
        /// <summary>
        /// The default action for this controller. Returns a view which lists all code lists at the given level
        /// </summary>
        /// <param name="org">The service owner code</param>
        /// <param name="service">The service code</param>
        /// <param name="edition">The service edition code</param>
        /// <returns>A view which lists all code lists at the given level</returns>
        public IActionResult Index(string org, string service, string edition)
        {
            AltinnStudioViewModel model = new AltinnStudioViewModel();

            model.Codelists = _repository.GetCodelists(org, service, edition);

            if (!string.IsNullOrEmpty(org) && string.IsNullOrEmpty(service))
            {
                model.RepositoryContent = _sourceControl.Status(org, "codelists");
            }
            return(View(model));
        }
コード例 #2
0
        public IActionResult Index(string org, string service)
        {
            AltinnStudioViewModel model = new AltinnStudioViewModel();

            model.Service = service;
            model.Org     = org;

            if (_sourceControl.IsLocalRepo(org, service))
            {
                model.IsLocalRepo       = true;
                model.ServiceEditions   = _repository.GetEditions(org, service);
                model.RepositoryContent = _sourceControl.Status(org, service);
                _sourceControl.FetchRemoteChanges(org, service);
                model.CommitsBehind = _sourceControl.CheckRemoteUpdates(org, service);
            }

            return(View(model));
        }
コード例 #3
0
        public IActionResult Status(string org, string app)
        {
            AltinnStudioViewModel model = new AltinnStudioViewModel();

            model.RepositoryContent = _sourceControl.Status(org, app);
            model.CommitInfo        = new CommitInfo()
            {
                Org = org, Repository = app
            };
            return(View(model));
        }
コード例 #4
0
 /// <inheritdoc/>
 public List <RepositoryContent> Status(string org, string repository)
 {
     try
     {
         return(_decoratedService.Status(org, repository));
     }
     catch (Exception ex)
     {
         LogError(ex, "Status", org, repository);
         throw;
     }
 }
コード例 #5
0
        /// <summary>
        /// The index action which will list basic information about the app, as well as
        /// all possible operations on the app.
        /// </summary>
        /// <param name="org">Unique identifier of the organisation responsible for the app.</param>
        /// <param name="app">Application identifier which is unique within an organisation.</param>
        /// <returns>A view with basic information and all available operations.</returns>
        public IActionResult Index(string org, string app)
        {
            ModelMetadata metadata = _repository.GetModelMetadata(org, app);
            IList <ServicePackageDetails> packageDetails = _repository.GetServicePackages(org, app);
            AltinnStudioViewModel         model          = new AltinnStudioViewModel();

            model.Service         = app;
            model.Org             = org;
            model.ServiceMetadata = metadata;

            if (_sourceControl.IsLocalRepo(org, app))
            {
                model.IsLocalRepo       = true;
                model.RepositoryContent = _sourceControl.Status(org, app);
                _sourceControl.FetchRemoteChanges(org, app);
                model.CommitsBehind = _sourceControl.CheckRemoteUpdates(org, app);
            }

            ViewBag.HasCreatedResources = _repository.GetLanguages(org, app).Any();
            ViewBag.HasSetConfiguration = _repository.GetConfiguration(org, app, "basic.json") != null;
            ViewBag.PackageDetails      = packageDetails;

            return(View(model));
        }
コード例 #6
0
        public ActionResult ContentsZip(string org, string repository, [FromQuery] bool full)
        {
            string appRoot = null;

            try
            {
                appRoot = _repository.GetAppPath(org, repository);

                if (!Directory.Exists(appRoot))
                {
                    return(BadRequest("User does not have a local clone of the repository."));
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                return(BadRequest("User does not have a local clone of the repository."));
            }

            var outStream = new MemoryStream();

            using (var archive = new ZipArchive(outStream, ZipArchiveMode.Create, leaveOpen: true))
            {
                IEnumerable <string> changedFiles;
                if (full)
                {
                    changedFiles = GetFilesInDirectory(appRoot, new DirectoryInfo(appRoot));
                }
                else
                {
                    changedFiles = _sourceControl.Status(org, repository).Select(f => f.FilePath);
                }

                foreach (var changedFile in changedFiles)
                {
                    archive.CreateEntryFromFile(Path.Join(appRoot, changedFile), changedFile);
                }
            }

            outStream.Seek(0, SeekOrigin.Begin);

            return(File(outStream, "application/zip", $"{org}-{repository}.zip"));
        }